﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Windows.Media;

namespace BrainTechLLC.BaseLibrary
{
    public class BasicImageSourcePopulator
    {
        public virtual ImageSource Populate(BasicImageSource imageSource)
        {
            ImageSource populated = null;
            imageSource.ImageSource = populated;
            imageSource.ImageSourceWidth = populated == null ? 0D : populated.Width;
            imageSource.ImageSourceHeight = populated == null ? 0D : populated.Height;
            return populated;
        }

        public virtual ImageSource PopulateIfEmpty(BasicImageSource imageSource)
        {
            ImageSource populated = imageSource.ImageSource;
            if (populated == null)
            {
                populated = Populate(imageSource);
            }
            return populated;
        }
    }
}
